package graph;


public class MyTimer {
	public MyTimer(){
		m_start = System.currentTimeMillis();
	}
	
	public long now(){
		if(m_inPause){
			return m_cum;
		}
		else{
			long nowTime = System.currentTimeMillis();
			return nowTime - m_start + m_cum;
		}
	}
	
	public void pause(){
		if(! m_inPause){
			m_cum = now();
			m_inPause = true;
		}
	}
	
	public void play(){
		if(m_inPause){
			m_start = System.currentTimeMillis();
			m_inPause = false;
		}
	}
	
	public void restart(){
		m_cum = 0;
		m_start = System.currentTimeMillis();
		m_inPause = false;
	}
	
	long m_start = 0;
	long m_cum = 0;
	boolean m_inPause = false;
}
